/**
 * @file bsp_gnss.h
 * @brief 
 * @author  ()
 * @version 1.0
 * @date 2024-09-13
 * @ingroup bsp
 * @copyright Copyright (C) 2019 Queclink Wireless Solutions (ShenZhen) Co., Ltd. All Rights Reserved.
 * 
 * @par 修改日志:
 * <table>
 * <tr><th>Date       <th>Version <th>Author  <th>Description
 * <tr><td>2024-09-13 <td>1.0     <td>     <td>内容
 * </table>
 */

#ifndef __BSP_GNSS_H
#define __BSP_GNSS_H

/* includes ---------------------------------------------------------------------------------------------------------*/
#include "hal_adapter.h"

#ifdef __cplusplus
extern "C" {
#endif

#define GNSS_UART_BAUDRATE          115200
#define GNSS_UART_TX_BUF            16
#define GNSS_UART_RX_BUF            1460

/* DA35D1C10 1598 byts per trans average */    
#define SERIAL_RX_BUFFER_SIZE  2048

typedef struct {
    uint8_t recv;
    uint8_t rx_buffer[SERIAL_RX_BUFFER_SIZE];
    uint16_t rx_head;
    volatile uint16_t rx_tail;
} serial_t;

extern ssize_t bsp_gnss_write(const void *data, size_t cnt);
extern ssize_t bsp_gnss_read(void *data, size_t max_size);
extern void bsp_gnss_power_on(void);
extern void bsp_gnss_power_off(void);
void bsp_gnss_set_baudrate(uint32_t bps);
void gnss_hw_init(void);
void gnss_uart_sleep(void);
void gnss_uart_wakeup(void);

#ifdef __cplusplus
}
#endif

#endif /* __BSP_H */
